﻿namespace CN2P.Web.Controllers.Api.Proxy
{
    using System.Collections.Generic;
    using System.Net;
    using System.Net.Http;
    using System.Web.Http;
    using CN2P.ServiceModel;

    public class RecommendationsApiProxyController : BaseApiProxyController
    {
        [AcceptVerbs("GET")]
        public IList<string> Get([FromUri]RecommendationRequestModel request)
        {
            return client.RecommendationsService.Get(request.prodId);
        }

        [AcceptVerbs("POST")]
        public HttpResponseMessage AddTraversal(RecommendationItemModel request)
        {
            client.RecommendationsService.AddTraversal(request.FromProdId, request.ToProdId);
            return Request.CreateResponse(HttpStatusCode.Created);
        }

        [AcceptVerbs("POST")]
        public HttpResponseMessage AddRating(string productId, float rating)
        {
            client.RecommendationsService.AddRating(productId, rating);
            return Request.CreateResponse(HttpStatusCode.Created);
        }

        [AcceptVerbs("DELETE")]
        public HttpResponseMessage DeleteAll()
        {
            client.RecommendationsService.DeleteAll();
            return Request.CreateResponse(HttpStatusCode.Created);
        }
    }
}